package com.jmb.api.web.custom.config;

import io.swagger.v3.oas.models.OpenAPI;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author jin
 */
@Configuration
public class Knife4jConfiguration {
    @Bean
    public OpenAPI custOmOpenApi() {
        return new OpenAPI()
                .info(new io.swagger.v3.oas.models.info.Info()
                        .title("接口文档")
                        .description("接口文档")
                        .version("1.0"));
    }
    @Bean
    public GroupedOpenApi userApi(){
        return GroupedOpenApi.builder()
                .group("用户管理")
                .pathsToMatch(
                        "/web/user/**")
                .build();
    }
    @Bean
    public GroupedOpenApi roleApi(){
        return GroupedOpenApi.builder()
                .group("角色管理")
                .pathsToMatch(
                        "/web/role/**")
                .build();
    }
    @Bean
    public GroupedOpenApi permissionApi(){
        return GroupedOpenApi.builder()
                .group("权限管理")
                .pathsToMatch(
                        "/web/permission/**")
                .build();
    }
    @Bean
    public GroupedOpenApi projectApi(){
        return GroupedOpenApi.builder()
                .group("项目管理")
                .pathsToMatch(
                        "/web/project/**")
                .build();
    }
    @Bean
    public GroupedOpenApi ModuleApi(){
        return GroupedOpenApi.builder()
                .group("模块管理")
                .pathsToMatch(
                        "/web/module/**")
                .build();
    }
    @Bean
    public GroupedOpenApi dbApi(){
        return GroupedOpenApi.builder()
                .group("数据源管理")
                .pathsToMatch(
                        "/web/db/**")
                .build();
    }

    @Bean
    public GroupedOpenApi dataApi(){
        return GroupedOpenApi.builder()
                .group("数据管理")
                .pathsToMatch(
                        "/web/dataFactory/**")
                .build();
    }

    @Bean
    public GroupedOpenApi loginApi(){
        return GroupedOpenApi.builder()
                .group("登录")
                .pathsToMatch(
                        "/web/login/**")
                .build();
    }
    @Bean
    public GroupedOpenApi assertApi(){
        return GroupedOpenApi.builder()
                .group("断言管理")
                .pathsToMatch(
                        "/web/interfaceAssert/**")
                .build();
    }
    @Bean
    public GroupedOpenApi preCaseApi(){
        return GroupedOpenApi.builder()
                .group("前置用例管理")
                .pathsToMatch(
                        "/web/interfacePreCase/**")
                .build();
    }
    @Bean
    public GroupedOpenApi postCaseApi(){
        return GroupedOpenApi.builder()
                .group("后置用例管理")
                .pathsToMatch(
                        "/web/interfacePostCase/**")
                .build();
    }
    @Bean
    public GroupedOpenApi caseApi(){
        return GroupedOpenApi.builder()
                .group("用例管理")
                .pathsToMatch(
                        "/web/interfaceCase/**")
                .build();
    }
}
